<style>
	@import "../../../common/css/adminHome.css";
</style>
<template>
	<view>
		<view class="personTop" style="height: 300rpx;">
			<!-- <image class="personTop_bg" src="../../../static/personBg.png" mode="aspectFill"></image> -->
			<view class="personTop_info" style="height: 0rpx;">
				<avatar :size="104" :marginTop="0" :src="userInfo.avatar" :marginLeft="46" style="float: left;"></avatar>
				<view class="personTop_con">
					<view class="personTop_info_name">{{userInfo.name}}</view>
					
				</view>
				<view class="personTop_setPwd">
					<!-- <view class="personTop_addAccount" @click="addAccount" v-if=" adminType == 2">创建账号</view>
					<view class="personTop_addAccount" @click="showEditPwd(userInfo.userId)">修改密码</view> -->
				</view>
				<!-- <view class="personTop_info_account">主账号:{{userInfo.account}}</view> -->
			</view>
			<view class="personTop_assets">
				<view class="personTop_assets_left">
					<view class="personTop_assets_left_title">选择采购截止日期:</view>
					<view class="personTop_assets_left_money">
						<view class="example-body" style="border-radius: 20rpx;height: 40rpx;width: 576rpx;">
							<uni-datetime-picker type="date" :value="single" @change="change" />
						</view>
					</view>
				</view>
				<!-- <view class="personTop_assets_cash_btn" @click="withdrawal()">
					提现
				</view> -->
			</view>
		</view>
	<!-- 	<view class="admin_common_page">
			<view class="top_fix">
				<view class="search_info">
				</view>
				<view class="">
					<view class="" style="color: #FBFBFB;">
						<text>选择采购截止日期:</text>
					</view>
					<view class="example-body" style="border-radius: 20rpx;">
						<uni-datetime-picker type="date" :value="single" @change="change" />
					</view>
				</view> -->
				<uni-table  border stripe emptyText="暂无更多数据" type="selection" style="margin-top: 10rpx;">
					<!-- 表头行 -->
					<uni-tr>
						<uni-th align="center">商品名称</uni-th>
						<uni-th align="center">商品数量</uni-th>
					</uni-tr>
					<!-- 表格数据行 -->
					<uni-tr v-for="(item, index) in list">
						<uni-td align="center">{{item.goodsName}}</uni-td>
						<uni-td align="center">{{item.goodsNumber}}</uni-td>
					</uni-tr>
				</uni-table>
				<view class="uni-form-item uni-column" style="background-color: #FFFFFF;margin-top: 20rpx;background-color: #FFFFFF;margin: 5px 5px 15px 5px;padding: 10rpx;box-shadow: 2px 5px 1px #888">
					<textarea class="uni-input" @input="onKeyInput" placeholder="备注:" style="width: 100%;height: 200rpx;"/>
				<!-- 	<textarea name="txt" clos="50" rows="5" warp="virtual"></textarea> -->
				</view>
				<button type="primary" @click="tijiao" style="background-color:#3B70FD;width: 700rpx;" >本次配货确认</button>
			
			<view class="order-content" @touchmove.stop.prevent>
				<view class="tabs-swiper-content">
					<u-tabs-swiper ref="uTabs" :list="dataList" :current="current" @change="tabsChange"
						:is-scroll="false" swiperWidth="750" :bgColor="tabColor" :inactiveColor="inactiveColor"
						:activeColor="activeColor">
					</u-tabs-swiper>
				</view>
				<swiper class="swipers" :style="{height: listSwiperHeight}" :current="swiperCurrent"
					@transition="transition" @animationfinish="animationfinish">
					<swiper-item class="swiper-item" v-for="(item, index) in dataList" :key="index">
						<scroll-tab-swiper-item :tabIndex="index" :currentIndex="swiperCurrent" @backOrder="backOrder">
						</scroll-tab-swiper-item>
					</swiper-item>
				</swiper>
			</view>
			<backOrder v-if="isShowBackOrder" :orderSn="backOrderSn" @cancelBackOrder="cancelBackOrder"
				@submitBackOrder="submitBackOrder"></backOrder>
			<createShop v-if="isShowAddShop" @cancelAddShop="cancelAddShop" @submitAddShop="submitAddShop"></createShop>
			<tabBarAdmin :pagePath="'/pages/admin/home/home'"></tabBarAdmin>
		<!-- </view> -->
		<tabBarAdmin :pagePath="'/pages/admin/caigou/caigou'"></tabBarAdmin>
	</view>
</template>
import cgSwiper from '@/components/cg-swiper/cg-swiper.vue';
import backOrder from '@/components/show-model/show-backOrder/back-order.vue'
import createShop from '@/components/show-model/show-createShop/create-shop.vue'
<script>
	export default {
		data() {
			return {
				inputValue: '',
				list: [], //采购列表
				single: '',
				datetimesingle: '2021-04-3',
				range: ['2021-03-8', '2021-4-20'],
				datetimerange: ['2021-03-20 20:10:10', '2021-05-10 10:10:10'],
			}
		},
		onLoad() {

		},
		watch: {
			datetimesingle(newval) {
				console.log('单选:', this.datetimesingle);
			},
		},
		mounted() {
			setTimeout(() => {
				let newDate = new Date();
				let years = newDate.getFullYear();
				let Months = newDate.getMonth() + 1;
				let Dates = newDate.getDate();
				console.log(years, Months + 1, Dates)
				this.datetimesingle = years + "-" + Months + "-" + Dates
				this.single = years + "-" + Months + "-" + Dates

			}, 1000)
		},
		methods: {
			onKeyInput: function(event) {
				this.inputValue = event.target.value
			},
			tijiao() {
				console.log("提交")
				let postData = {
					endTime: this.single,
					remark: this.inputValue
				}
				console.log(106, postData)
				this.$api.caigou.tijiao(postData)
					.then(res => {
						if (res.code == 200) {					
							console.log(res.data)
							this.$commonJs.showToast.showNoneToast(res.msg)
							this.list = res.data
						} else {
							this.$commonJs.showToast.showNoneToast(res.err)
						}
					})
					.catch(err => {
						this.$commonJs.showToast.showNoneToast(err)
					})
			},
			change(e) {
				this.single = e
				console.log('----change事件:', this.single = e);
				let postData = {
					endTime: this.single
				}
				console.log(106, postData)
				this.$api.caigou.caigous(postData)
					.then(res => {
						if (res.code == 200) {						
							console.log(res.data)
							if (res.data.length == 0) {
								uni.showToast({
									title: "没有更多内容",
									icon:"error",
									duration: 1500
								})
								this.list = res.data
								
							} else {
								this.list = res.data
							}
							
						} else {
							this.$commonJs.showToast.showNoneToast(res.err)
						}
					})
					.catch(err => {
						this.$commonJs.showToast.showNoneToast(err)
					})
			},
			changeLog(e) {
				console.log('----change事件:', e);
			},
			maskClick(e) {
				console.log('----maskClick事件:', e);
			}
		}
	}
</script>
<style lang="scss">
	@import '@/common/uni-nvue.scss';
</style>
